//////////////////////////////////////////////////////////////////////////
// PeekPocket - the hassle-free WiFi scanner for Windows Mobile
// coded by dzolee
// http://dzolee.blogspot.com
//
// Setting storage: provides access to numeric/string settings that can
// be read from and written to registry.
//
//////////////////////////////////////////////////////////////////////////
#pragma once

//////////////////////////////////////////////////////////////////////////
enum NumericSettingsEnum
{
	nseFontSize=0,
	nseScanSpeed,
	nseHideWEP,
	nseHidePeer,
	nseSoundOff,
	nseLanguage,

	nseMAX
};

//////////////////////////////////////////////////////////////////////////
enum LanguagesEnum
{
	// strings 2000 -
	leEnglish=0,

	// strings 2200 -
	leHungarian,

	// strings 2400 -
	lePolish,

	// strings 2600 -
	leFrench,

	// strings 2800 -
	lePortuguese,

	// strings 3000 -
	leRussian,

	// strings 3200 -
	leGerman,

	// strings 3400 -
	leDutch,

	// strings 3600 -
	leItalian,

	// strings 3800 -
	leCzech,

	// strings 4000 -
	leDanish,

	// strings 4200 -
	leNorwegian,

	// strings 4400 -
	leSwedish,

	// strings 4600 -
	leSpanish,

	leMAX
};

//////////////////////////////////////////////////////////////////////////
enum StringSettingsEnum
{
	sseAdapter=0,

	sseMAX
};

//////////////////////////////////////////////////////////////////////////
struct NumericSetting
{
	CString m_strName;
	bool m_bReadFromRegistry;
	DWORD m_dwDefault;
	DWORD m_dwValue;
	bool m_bUsingDefault;

	NumericSetting()
	{
	}

	NumericSetting(CString strName, bool bReadFromRegistry, DWORD dwDefault, DWORD dwValue, bool bUsingDefault) : \
		m_strName(strName), m_bReadFromRegistry(bReadFromRegistry), m_dwDefault(dwDefault), m_dwValue(dwValue), m_bUsingDefault(bUsingDefault)
	{
	}
};

//////////////////////////////////////////////////////////////////////////
struct StringSetting
{
	CString m_strName;
	bool m_bReadFromRegistry;
	CString m_strDefault;
	CString m_strValue;
	bool m_bUsingDefault;

	StringSetting(CString strName, bool bReadFromRegistry, CString strDefault, CString strValue, bool bUsingDefault) : \
		m_strName(strName), m_bReadFromRegistry(bReadFromRegistry), m_strDefault(strDefault), m_strValue(strValue), m_bUsingDefault(bUsingDefault)
	{
	}
	StringSetting()
	{

	}
};

//////////////////////////////////////////////////////////////////////////
class CSettingsStorage
{
public:
	CSettingsStorage();
	~CSettingsStorage();

	bool Deserialize();
	bool Serialize();
	bool GetNumeric(NumericSettingsEnum nseItem, DWORD &dwOut);
	bool GetString(StringSettingsEnum sseItem, CString &strOut);
	bool SetNumeric(NumericSettingsEnum nseItem, DWORD dwIn);
	bool SetString(StringSettingsEnum sseItem, CString strIn);
	DWORD GetScanSpeed();

private:
	//name | should be read from registry? | default value | current value | using default?
	NumericSetting m_NumSet[nseMAX];
	StringSetting m_StrSet[sseMAX];
};



//////////////////////////////////////////////////////////////////////////